"use strict";var ke=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var wt=Object.prototype.hasOwnProperty;var Pt=(e,t)=>{for(var n in t)ke(e,n,{get:t[n],enumerable:!0})},Se=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mt(t))!wt.call(e,a)&&a!==n&&ke(e,a,{get:()=>t[a],enumerable:!(r=Rt(t,a))||r.enumerable});return e},C=(e,t,n)=>(Se(e,t,"default"),n&&Se(n,t,"default"));var bt=e=>Se(ke({},"__esModule",{value:!0}),e);var k={};Pt(k,{ReducerType:()=>Oe,SHOULD_AUTOBATCH:()=>ne,TaskAbortError:()=>P,Tuple:()=>O,addListener:()=>Le,asyncThunkCreator:()=>rt,autoBatchEnhancer:()=>re,buildCreateSlice:()=>Ne,clearAllListeners:()=>Ue,combineSlices:()=>Et,configureStore:()=>et,createAction:()=>M,createActionCreatorInvariantMiddleware:()=>Be,createAsyncThunk:()=>ce,createDraftSafeSelector:()=>J,createDraftSafeSelectorCreator:()=>ge,createDynamicMiddleware:()=>xt,createEntityAdapter:()=>dt,createImmutableStateInvariantMiddleware:()=>He,createListenerMiddleware:()=>kt,createNextState:()=>I.produce,createReducer:()=>oe,createSelector:()=>L.createSelector,createSelectorCreator:()=>L.createSelectorCreator,createSerializableStateInvariantMiddleware:()=>Xe,createSlice:()=>at,current:()=>I.current,findNonSerializableValue:()=>Me,formatProdErrorMessage:()=>S,freeze:()=>I.freeze,isActionCreator:()=>Y,isAllOf:()=>z,isAnyOf:()=>j,isAsyncThunkAction:()=>Ie,isDraft:()=>I.isDraft,isFluxStandardAction:()=>Z,isFulfilled:()=>be,isImmutableDefault:()=>Ke,isPending:()=>we,isPlain:()=>Re,isRejected:()=>B,isRejectedWithValue:()=>Pe,lruMemoize:()=>L.lruMemoize,miniSerializeError:()=>ve,nanoid:()=>w,original:()=>I.original,prepareAutoBatched:()=>Qe,removeListener:()=>We,unwrapResult:()=>De,weakMapMemoize:()=>L.weakMapMemoize});module.exports=bt(k);C(k,require("redux"),module.exports);var I=require("immer"),L=require("reselect");var q=require("immer"),X=require("reselect"),ge=(...e)=>{let t=(0,X.createSelectorCreator)(...e);return(...n)=>{let r=t(...n),a=(i,...u)=>r((0,q.isDraft)(i)?(0,q.current)(i):i,...u);return Object.assign(a,r),a}},J=ge(X.weakMapMemoize);var b=require("redux");var xe=require("redux"),Ge=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?xe.compose:xe.compose.apply(null,arguments)},ln=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}};var te=require("redux-thunk");var Ce=require("redux");var Q=e=>e&&typeof e.match=="function";function M(e,t){function n(...r){if(t){let a=t(...r);if(!a)throw new Error(S(0));return{type:e,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>(0,Ce.isAction)(r)&&r.type===e,n}function Y(e){return typeof e=="function"&&"type"in e&&Q(e)}function Z(e){return(0,Ce.isAction)(e)&&Object.keys(e).every(It)}function It(e){return["type","payload","error","meta"].indexOf(e)>-1}function vt(e){let t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. 
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}function Be(e={}){return()=>n=>r=>n(r)}var ee=require("immer");function G(e,t){for(let n of e)if(t(n))return n}var O=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Ee(e){return(0,ee.isDraftable)(e)?(0,ee.produce)(e,()=>{}):e}function U(e,t,n){if(e.has(t)){let a=e.get(t);return n.update&&(a=n.update(a,t,e),e.set(t,a)),a}if(!n.insert)throw new Error(S(10));let r=n.insert(t,e);return e.set(t,r),r}function Ke(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function He(e={}){if(1)return()=>r=>a=>r(a);var t,n}var $e=require("redux");function Re(e){let t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||(0,$e.isPlainObject)(e)}function Me(e,t="",n=Re,r,a=[],i){let u;if(!n(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||i?.has(e))return!1;let f=r!=null?r(e):Object.entries(e),d=a.length>0;for(let[h,o]of f){let l=t?t+"."+h:h;if(!(d&&a.some(g=>g instanceof RegExp?g.test(l):l===g))){if(!n(o))return{keyPath:l,value:o};if(typeof o=="object"&&(u=Me(o,l,n,r,a,i),u))return u}}return i&&qe(e)&&i.add(e),!1}function qe(e){if(!Object.isFrozen(e))return!1;for(let t of Object.values(e))if(!(typeof t!="object"||t===null)&&!qe(t))return!1;return!0}function Xe(e={}){return()=>t=>n=>t(n)}function Dt(e){return typeof e=="boolean"}var Je=()=>function(t){let{thunk:n=!0,immutableCheck:r=!0,serializableCheck:a=!0,actionCreatorCheck:i=!0}=t??{},u=new O;return n&&(Dt(n)?u.push(te.thunk):u.push((0,te.withExtraArgument)(n.extraArgument))),u};var ne="RTK_autoBatch",Qe=()=>e=>({payload:e,meta:{[ne]:!0}}),Ye=e=>t=>{setTimeout(t,e)},Ot=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Ye(10),re=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),a=!0,i=!1,u=!1,f=new Set,d=e.type==="tick"?queueMicrotask:e.type==="raf"?Ot:e.type==="callback"?e.queueNotification:Ye(e.timeout),h=()=>{u=!1,i&&(i=!1,f.forEach(o=>o()))};return Object.assign({},r,{subscribe(o){let l=()=>a&&o(),y=r.subscribe(l);return f.add(o),()=>{y(),f.delete(o)}},dispatch(o){try{return a=!o?.meta?.[ne],i=!a,i&&(u||(u=!0,d(h))),r.dispatch(o)}finally{a=!0}}})};var Ze=e=>function(n){let{autoBatch:r=!0}=n??{},a=new O(e);return r&&a.push(re(typeof r=="object"?r:void 0)),a};var N=!0;function et(e){let t=Je(),{reducer:n=void 0,middleware:r,devTools:a=!0,preloadedState:i=void 0,enhancers:u=void 0}=e||{},f;if(typeof n=="function")f=n;else if((0,b.isPlainObject)(n))f=(0,b.combineReducers)(n);else throw new Error(S(1));if(!N&&r&&typeof r!="function")throw new Error(S(2));let d;if(typeof r=="function"){if(d=r(t),!N&&!Array.isArray(d))throw new Error(S(3))}else d=t();if(!N&&d.some(p=>typeof p!="function"))throw new Error(S(4));let h=b.compose;a&&(h=Ge({trace:!N,...typeof a=="object"&&a}));let o=(0,b.applyMiddleware)(...d),l=Ze(o);if(!N&&u&&typeof u!="function")throw new Error(S(5));let y=typeof u=="function"?u(l):l();if(!N&&!Array.isArray(y))throw new Error(S(6));if(!N&&y.some(p=>typeof p!="function"))throw new Error(S(7));!N&&d.length&&!y.includes(o)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");let g=h(...y);return(0,b.createStore)(f,i,g)}var W=require("immer");function ae(e){let t={},n=[],r,a={addCase(i,u){let f=typeof i=="string"?i:i.type;if(!f)throw new Error(S(28));if(f in t)throw new Error(S(29));return t[f]=u,a},addMatcher(i,u){return n.push({matcher:i,reducer:u}),a},addDefaultCase(i){return r=i,a}};return e(a),[t,n,r]}function Nt(e){return typeof e=="function"}function oe(e,t){let[n,r,a]=ae(t),i;if(Nt(e))i=()=>Ee(e());else{let f=Ee(e);i=()=>f}function u(f=i(),d){let h=[n[d.type],...r.filter(({matcher:o})=>o(d)).map(({reducer:o})=>o)];return h.filter(o=>!!o).length===0&&(h=[a]),h.reduce((o,l)=>{if(l)if((0,W.isDraft)(o)){let g=l(o,d);return g===void 0?o:g}else{if((0,W.isDraftable)(o))return(0,W.produce)(o,y=>l(y,d));{let y=l(o,d);if(y===void 0){if(o===null)return o;throw new Error(S(9))}return y}}return o},f)}return u.getInitialState=i,u}var jt="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",w=(e=21)=>{let t="",n=e;for(;n--;)t+=jt[Math.random()*64|0];return t};var tt=(e,t)=>Q(e)?e.match(t):e(t);function j(...e){return t=>e.some(n=>tt(n,t))}function z(...e){return t=>e.every(n=>tt(n,t))}function ie(e,t){if(!e||!e.meta)return!1;let n=typeof e.meta.requestId=="string",r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function K(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function we(...e){return e.length===0?t=>ie(t,["pending"]):K(e)?t=>{let n=e.map(a=>a.pending);return j(...n)(t)}:we()(e[0])}function B(...e){return e.length===0?t=>ie(t,["rejected"]):K(e)?t=>{let n=e.map(a=>a.rejected);return j(...n)(t)}:B()(e[0])}function Pe(...e){let t=n=>n&&n.meta&&n.meta.rejectedWithValue;return e.length===0?n=>z(B(...e),t)(n):K(e)?n=>z(B(...e),t)(n):Pe()(e[0])}function be(...e){return e.length===0?t=>ie(t,["fulfilled"]):K(e)?t=>{let n=e.map(a=>a.fulfilled);return j(...n)(t)}:be()(e[0])}function Ie(...e){return e.length===0?t=>ie(t,["pending","fulfilled","rejected"]):K(e)?t=>{let n=[];for(let a of e)n.push(a.pending,a.rejected,a.fulfilled);return j(...n)(t)}:Ie()(e[0])}var Ft=["name","message","stack","code"],H=class{constructor(t,n){this.payload=t;this.meta=n}_type},se=class{constructor(t,n){this.payload=t;this.meta=n}_type},ve=e=>{if(typeof e=="object"&&e!==null){let t={};for(let n of Ft)typeof e[n]=="string"&&(t[n]=e[n]);return t}return{message:String(e)}},ce=(()=>{function e(t,n,r){let a=M(t+"/fulfilled",(d,h,o,l)=>({payload:d,meta:{...l||{},arg:o,requestId:h,requestStatus:"fulfilled"}})),i=M(t+"/pending",(d,h,o)=>({payload:void 0,meta:{...o||{},arg:h,requestId:d,requestStatus:"pending"}})),u=M(t+"/rejected",(d,h,o,l,y)=>({payload:l,error:(r&&r.serializeError||ve)(d||"Rejected"),meta:{...y||{},arg:o,requestId:h,rejectedWithValue:!!l,requestStatus:"rejected",aborted:d?.name==="AbortError",condition:d?.name==="ConditionError"}}));function f(d){return(h,o,l)=>{let y=r?.idGenerator?r.idGenerator(d):w(),g=new AbortController,p;function s(c){p=c,g.abort()}let A=async function(){let c;try{let m=r?.condition?.(d,{getState:o,extra:l});if(Vt(m)&&(m=await m),m===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let x=new Promise((R,D)=>g.signal.addEventListener("abort",()=>D({name:"AbortError",message:p||"Aborted"})));h(i(y,d,r?.getPendingMeta?.({requestId:y,arg:d},{getState:o,extra:l}))),c=await Promise.race([x,Promise.resolve(n(d,{dispatch:h,getState:o,extra:l,requestId:y,signal:g.signal,abort:s,rejectWithValue:(R,D)=>new H(R,D),fulfillWithValue:(R,D)=>new se(R,D)})).then(R=>{if(R instanceof H)throw R;return R instanceof se?a(R.payload,y,d,R.meta):a(R,y,d)})])}catch(m){c=m instanceof H?u(null,y,d,m.payload,m.meta):u(m,y,d)}return r&&!r.dispatchConditionRejection&&u.match(c)&&c.meta.condition||h(c),c}();return Object.assign(A,{abort:s,requestId:y,arg:d,unwrap(){return A.then(De)}})}}return Object.assign(f,{pending:i,rejected:u,fulfilled:a,settled:j(u,a),typePrefix:t})}return e.withTypes=()=>e,e})();function De(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Vt(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var nt=Symbol.for("rtk-slice-createasyncthunk"),rt={[nt]:ce},Oe=(r=>(r.reducer="reducer",r.reducerWithPrepare="reducerWithPrepare",r.asyncThunk="asyncThunk",r))(Oe||{});function _t(e,t){return`${e}/${t}`}function Ne({creators:e}={}){let t=e?.asyncThunk?.[nt];return function(r){let{name:a,reducerPath:i=a}=r;if(!a)throw new Error(S(11));typeof process<"u";let u=(typeof r.reducers=="function"?r.reducers(Ut()):r.reducers)||{},f=Object.keys(u),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},h={addCase(s,A){let c=typeof s=="string"?s:s.type;if(!c)throw new Error(S(12));if(c in d.sliceCaseReducersByType)throw new Error(S(13));return d.sliceCaseReducersByType[c]=A,h},addMatcher(s,A){return d.sliceMatchers.push({matcher:s,reducer:A}),h},exposeAction(s,A){return d.actionCreators[s]=A,h},exposeCaseReducer(s,A){return d.sliceCaseReducersByName[s]=A,h}};f.forEach(s=>{let A=u[s],c={reducerName:s,type:_t(a,s),createNotation:typeof r.reducers=="function"};zt(A)?Bt(c,A,h,t):Wt(c,A,h)});function o(){let[s={},A=[],c=void 0]=typeof r.extraReducers=="function"?ae(r.extraReducers):[r.extraReducers],T={...s,...d.sliceCaseReducersByType};return oe(r.initialState,m=>{for(let x in T)m.addCase(x,T[x]);for(let x of d.sliceMatchers)m.addMatcher(x.matcher,x.reducer);for(let x of A)m.addMatcher(x.matcher,x.reducer);c&&m.addDefaultCase(c)})}let l=s=>s,y=new WeakMap,g,p={name:a,reducerPath:i,reducer(s,A){return g||(g=o()),g(s,A)},actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState(){return g||(g=o()),g.getInitialState()},getSelectors(s=l){let A=U(y,this,{insert:()=>new WeakMap});return U(A,s,{insert:()=>{let c={};for(let[T,m]of Object.entries(r.selectors??{}))c[T]=Lt(this,m,s,this!==p);return c}})},selectSlice(s){let A=s[this.reducerPath];return typeof A>"u"&&this!==p&&(A=this.getInitialState()),A},get selectors(){return this.getSelectors(this.selectSlice)},injectInto(s,{reducerPath:A,...c}={}){let T=A??this.reducerPath;return s.inject({reducerPath:T,reducer:this.reducer},c),{...this,reducerPath:T}}};return p}}function Lt(e,t,n,r){function a(i,...u){let f=n.call(e,i);return typeof f>"u"&&r&&(f=e.getInitialState()),t(f,...u)}return a.unwrapped=t,a}var at=Ne();function Ut(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function Wt({type:e,reducerName:t,createNotation:n},r,a){let i,u;if("reducer"in r){if(n&&!Gt(r))throw new Error(S(17));i=r.reducer,u=r.prepare}else i=r;a.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,u?M(e,u):M(e))}function zt(e){return e._reducerDefinitionType==="asyncThunk"}function Gt(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Bt({type:e,reducerName:t},n,r,a){if(!a)throw new Error(S(18));let{payloadCreator:i,fulfilled:u,pending:f,rejected:d,settled:h,options:o}=n,l=a(e,i,o);r.exposeAction(t,l),u&&r.addCase(l.fulfilled,u),f&&r.addCase(l.pending,f),d&&r.addCase(l.rejected,d),h&&r.addMatcher(l.settled,h),r.exposeCaseReducer(t,{fulfilled:u||de,pending:f||de,rejected:d||de,settled:h||de})}function de(){}function Kt(){return{ids:[],entities:{}}}function ot(){function e(t={}){return Object.assign(Kt(),t)}return{getInitialState:e}}function it(){function e(t,n={}){let{createSelector:r=J}=n,a=l=>l.ids,i=l=>l.entities,u=r(a,i,(l,y)=>l.map(g=>y[g])),f=(l,y)=>y,d=(l,y)=>l[y],h=r(a,l=>l.length);if(!t)return{selectIds:a,selectEntities:i,selectAll:u,selectTotal:h,selectById:r(i,f,d)};let o=r(t,i);return{selectIds:r(t,a),selectEntities:o,selectAll:r(t,u),selectTotal:r(t,h),selectById:r(o,f,d)}}return{getSelectors:e}}var ue=require("immer");var Ht=ue.isDraft;function st(e){let t=E((n,r)=>e(r));return function(r){return t(r,void 0)}}function E(e){return function(n,r){function a(u){return Z(u)}let i=u=>{a(r)?e(r.payload,u):e(r,u)};return Ht(n)?(i(n),n):(0,ue.produce)(n,i)}}function F(e,t){return t(e)}function v(e){return Array.isArray(e)||(e=Object.values(e)),e}function le(e,t,n){e=v(e);let r=[],a=[];for(let i of e){let u=F(i,t);u in n.entities?a.push({id:u,changes:i}):r.push(i)}return[r,a]}function pe(e){function t(p,s){let A=F(p,e);A in s.entities||(s.ids.push(A),s.entities[A]=p)}function n(p,s){p=v(p);for(let A of p)t(A,s)}function r(p,s){let A=F(p,e);A in s.entities||s.ids.push(A),s.entities[A]=p}function a(p,s){p=v(p);for(let A of p)r(A,s)}function i(p,s){p=v(p),s.ids=[],s.entities={},n(p,s)}function u(p,s){return f([p],s)}function f(p,s){let A=!1;p.forEach(c=>{c in s.entities&&(delete s.entities[c],A=!0)}),A&&(s.ids=s.ids.filter(c=>c in s.entities))}function d(p){Object.assign(p,{ids:[],entities:{}})}function h(p,s,A){let c=A.entities[s.id];if(c===void 0)return!1;let T=Object.assign({},c,s.changes),m=F(T,e),x=m!==s.id;return x&&(p[s.id]=m,delete A.entities[s.id]),A.entities[m]=T,x}function o(p,s){return l([p],s)}function l(p,s){let A={},c={};p.forEach(m=>{m.id in s.entities&&(c[m.id]={id:m.id,changes:{...c[m.id]?c[m.id].changes:null,...m.changes}})}),p=Object.values(c),p.length>0&&p.filter(x=>h(A,x,s)).length>0&&(s.ids=Object.values(s.entities).map(x=>F(x,e)))}function y(p,s){return g([p],s)}function g(p,s){let[A,c]=le(p,e,s);l(c,s),n(A,s)}return{removeAll:st(d),addOne:E(t),addMany:E(n),setOne:E(r),setMany:E(a),setAll:E(i),updateOne:E(o),updateMany:E(l),upsertOne:E(y),upsertMany:E(g),removeOne:E(u),removeMany:E(f)}}function ct(e,t){let{removeOne:n,removeMany:r,removeAll:a}=pe(e);function i(c,T){return u([c],T)}function u(c,T){c=v(c);let m=c.filter(x=>!(F(x,e)in T.entities));m.length!==0&&s(m,T)}function f(c,T){return d([c],T)}function d(c,T){c=v(c),c.length!==0&&s(c,T)}function h(c,T){c=v(c),T.entities={},T.ids=[],u(c,T)}function o(c,T){return l([c],T)}function l(c,T){let m=!1;for(let x of c){let R=T.entities[x.id];if(!R)continue;m=!0,Object.assign(R,x.changes);let D=e(R);x.id!==D&&(delete T.entities[x.id],T.entities[D]=R)}m&&A(T)}function y(c,T){return g([c],T)}function g(c,T){let[m,x]=le(c,e,T);l(x,T),u(m,T)}function p(c,T){if(c.length!==T.length)return!1;for(let m=0;m<c.length&&m<T.length;m++)if(c[m]!==T[m])return!1;return!0}function s(c,T){c.forEach(m=>{T.entities[e(m)]=m}),A(T)}function A(c){let T=Object.values(c.entities);T.sort(t);let m=T.map(e),{ids:x}=c;p(x,m)||(c.ids=m)}return{removeOne:n,removeMany:r,removeAll:a,addOne:E(i),updateOne:E(o),upsertOne:E(y),setOne:E(f),setMany:E(d),setAll:E(h),addMany:E(u),updateMany:E(l),upsertMany:E(g)}}function dt(e={}){let{selectId:t,sortComparer:n}={sortComparer:!1,selectId:u=>u.id,...e},r=ot(),a=it(),i=n?ct(t,n):pe(t);return{selectId:t,sortComparer:n,...r,...a,...i}}var mt=require("redux");var fe=(e,t)=>{if(typeof e!="function")throw new Error(S(32))},ye=()=>{},he=(e,t=ye)=>(e.catch(t),e),Ae=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),V=(e,t)=>{let n=e.signal;n.aborted||("reason"in n||Object.defineProperty(n,"reason",{enumerable:!0,value:t,configurable:!0,writable:!0}),e.abort(t))};var $t="task",ut="listener",lt="completed",je="cancelled",pt=`task-${je}`,ft=`task-${lt}`,Te=`${ut}-${je}`,yt=`${ut}-${lt}`,P=class{constructor(t){this.code=t;this.message=`${$t} ${je} (reason: ${t})`}name="TaskAbortError";message};var _=e=>{if(e.aborted){let{reason:t}=e;throw new P(t)}};function Fe(e,t){let n=ye;return new Promise((r,a)=>{let i=()=>a(new P(e.reason));if(e.aborted){i();return}n=Ae(e,i),t.finally(()=>n()).then(r,a)}).finally(()=>{n=ye})}var ht=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof P?"cancelled":"rejected",error:n}}finally{t?.()}},$=e=>t=>he(Fe(e,t).then(n=>(_(e),n))),Ve=e=>{let t=$(e);return n=>t(new Promise(r=>setTimeout(r,n)))};var{assign:qt}=Object,At={},me="listenerMiddleware",Xt=(e,t)=>{let n=r=>Ae(e,()=>V(r,e.reason));return(r,a)=>{fe(r,"taskExecutor");let i=new AbortController;n(i);let u=ht(async()=>{_(e),_(i.signal);let f=await r({pause:$(i.signal),delay:Ve(i.signal),signal:i.signal});return _(i.signal),f},()=>V(i,ft));return a?.autoJoin&&t.push(u),{result:$(e)(u),cancel(){V(i,pt)}}}},Jt=(e,t)=>{let n=async(r,a)=>{_(t);let i=()=>{},f=[new Promise((d,h)=>{let o=e({predicate:r,effect:(l,y)=>{y.unsubscribe(),d([l,y.getState(),y.getOriginalState()])}});i=()=>{o(),h()}})];a!=null&&f.push(new Promise(d=>setTimeout(d,a,null)));try{let d=await Fe(t,Promise.race(f));return _(t),d}finally{i()}};return(r,a)=>he(n(r,a))},St=e=>{let{type:t,actionCreator:n,matcher:r,predicate:a,effect:i}=e;if(t)a=M(t).match;else if(n)t=n.type,a=n.match;else if(r)a=r;else if(!a)throw new Error(S(21));return fe(i,"options.listener"),{predicate:a,type:t,effect:i}},Qt=e=>{let{type:t,predicate:n,effect:r}=St(e);return{id:w(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(S(22))}}},_e=e=>{e.pending.forEach(t=>{V(t,Te)})},Yt=e=>()=>{e.forEach(_e),e.clear()},Tt=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},Le=M(`${me}/add`),Ue=M(`${me}/removeAll`),We=M(`${me}/remove`),Zt=(...e)=>{console.error(`${me}/error`,...e)};function kt(e={}){let t=new Map,{extra:n,onError:r=Zt}=e;fe(r,"onError");let a=o=>(o.unsubscribe=()=>t.delete(o.id),t.set(o.id,o),l=>{o.unsubscribe(),l?.cancelActive&&_e(o)}),i=o=>{let l=G(Array.from(t.values()),y=>y.effect===o.effect);return l||(l=Qt(o)),a(l)},u=o=>{let{type:l,effect:y,predicate:g}=St(o),p=G(Array.from(t.values()),s=>(typeof l=="string"?s.type===l:s.predicate===g)&&s.effect===y);return p&&(p.unsubscribe(),o.cancelActive&&_e(p)),!!p},f=async(o,l,y,g)=>{let p=new AbortController,s=Jt(i,p.signal),A=[];try{o.pending.add(p),await Promise.resolve(o.effect(l,qt({},y,{getOriginalState:g,condition:(c,T)=>s(c,T).then(Boolean),take:s,delay:Ve(p.signal),pause:$(p.signal),extra:n,signal:p.signal,fork:Xt(p.signal,A),unsubscribe:o.unsubscribe,subscribe:()=>{t.set(o.id,o)},cancelActiveListeners:()=>{o.pending.forEach((c,T,m)=>{c!==p&&(V(c,Te),m.delete(c))})},cancel:()=>{V(p,Te),o.pending.delete(p)},throwIfCancelled:()=>{_(p.signal)}})))}catch(c){c instanceof P||Tt(r,c,{raisedBy:"effect"})}finally{await Promise.allSettled(A),V(p,yt),o.pending.delete(p)}},d=Yt(t);return{middleware:o=>l=>y=>{if(!(0,mt.isAction)(y))return l(y);if(Le.match(y))return i(y.payload);if(Ue.match(y)){d();return}if(We.match(y))return u(y.payload);let g=o.getState(),p=()=>{if(g===At)throw new Error(S(23));return g},s;try{if(s=l(y),t.size>0){let A=o.getState(),c=Array.from(t.values());for(let T of c){let m=!1;try{m=T.predicate(y,A,g)}catch(x){m=!1,Tt(r,x,{raisedBy:"predicate"})}m&&f(T,y,o,p)}}}finally{g=At}return s},startListening:i,stopListening:u,clearListeners:d}}var gt=require("redux");var en=e=>({id:w(),middleware:e,applied:new Map}),tn=e=>t=>t?.meta?.instanceId===e,xt=()=>{let e=w(),t=new Map,n=Object.assign(M("dynamicMiddleware/add",(...f)=>({payload:f,meta:{instanceId:e}})),{withTypes:()=>n}),r=Object.assign(function(...d){d.forEach(h=>{let o=G(Array.from(t.values()),l=>l.middleware===h);o||(o=en(h)),t.set(o.id,o)})},{withTypes:()=>r}),a=f=>{let d=Array.from(t.values()).map(h=>U(h.applied,f,{insert:()=>h.middleware(f)}));return(0,gt.compose)(...d)},i=z(n,tn(e));return{middleware:f=>d=>h=>i(h)?(r(...h.payload),f.dispatch):a(f)(d)(h),addMiddleware:r,withMiddleware:n,instanceId:e}};var Ct=require("redux");var nn=e=>"reducerPath"in e&&typeof e.reducerPath=="string",rn=e=>e.flatMap(t=>nn(t)?[[t.reducerPath,t.reducer]]:Object.entries(t)),ze=Symbol.for("rtk-state-proxy-original"),an=e=>!!e&&!!e[ze],on=new WeakMap,sn=(e,t)=>U(on,e,{insert:()=>new Proxy(e,{get:(n,r,a)=>{if(r===ze)return n;let i=Reflect.get(n,r,a);if(typeof i>"u"){let u=t[r.toString()];if(u){let f=u(void 0,{type:w()});if(typeof f>"u")throw new Error(S(24));return f}}return i}})}),cn=e=>{if(!an(e))throw new Error(S(25));return e[ze]};function Et(...e){let t=Object.fromEntries(rn(e)),n=()=>(0,Ct.combineReducers)(t),r=n();function a(f,d){return r(f,d)}a.withLazyLoadedSlices=()=>a;let i=(f,d={})=>{let{reducerPath:h,reducer:o}=f,l=t[h];return!d.overrideExisting&&l&&l!==o?(typeof process<"u",a):(t[h]=o,r=n(),a)},u=Object.assign(function(d,h){return function(l,...y){return d(sn(h?h(l,...y):l,t),...y)}},{original:cn});return Object.assign(a,{inject:i,selector:u})}function S(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}
//# sourceMappingURL=redux-toolkit.production.min.cjs.map